<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php if (!session_id()) session_start(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>电子商务售前单</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <link href="demo.css" rel="stylesheet" type="text/css"/>
    <script src="scripts/boot.js" type="text/javascript"></script>
    <script src="scripts/ajaxfileupload.js" type="text/javascript"></script>
    <style>
        .myrow {
            background: #eb9393;
        }
    </style>

</head>
<body>

<fieldset id="fd1" style="border: 1px solid gray;height: 50px">
    <legend><span>搜索</span></legend>
    <div id='fm1'>
        <div class="fieldset-body">
            客户代码:
            <div class="mini-autocomplete" style="width:100px;" popupWidth="400" textField="id" valueField="id"
                 id='Customer_Code' name='Customer_Code'
                 url="/sale/getOCRDByCode" value="" text="" onvaluechanged="onValueChanged">
                <div property="columns">
                    <div header="客户代码" field="id" width="30"></div>
                    <div header="客户名称" field="text"></div>
                </div>
            </div>

            <!--            客户名称: <input readonly type="input" class='mini-textbox' id='cname-show' style="width: 250px"/>-->

<!--            上架清单名称: <input type="input" class="mini-buttonedit" onbuttonclick="onButtonEditB" id='shelves_list_name' style="width: 200px"/>-->
            物料名，物料号: <input type="input" class="mini-textbox" id='itemInfo' style="width: 150px"/>
<!--            <a class="mini-button" iconCls="icon-download" onclick="exportExcel()">导出清单(无平台商品代码)</a>-->
</fieldset>


<div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;margin-top: 5px;overflow:auto;" plain="false"
     buttons="#tabsButtons"
>
    <div title="筛选：上架类型：0普通,1活动,2集采. || 状态：1通知发出,2提报,3上架,4下架. ">

        <div id="datagrid1" class="mini-datagrid" url="/shelves/getItemForPM" style="height:330px;width: 100%;"
             idField="id"
             allowResize="true" showFilterRow="true"
             allowCellEdit="true" allowCellSelect="true" multiSelect="true"
             allowCellValid="true" showPage='True'
             onCellendedit='cellendedit'>

            <div property="columns">
                <div type="checkcolumn"></div>
                <div field="oa_id" headerAlign="center">OA物料号
                    <input property="readonly" class="mini-textbox" style="width:100%;"/>
                </div>

                <div field="logo"  headerAlign="center"  >Logo
                    <input property="" class="mini-textbox" style="width:100%;" />
                </div>

                <div field="ctime" headerAlign="center" allowSort="false">通知时间
                </div>
                <div field="tb_time" headerAlign="center" allowSort="false">提报时间
                </div>
                <div field="online_time" headerAlign="center" allowSort="false">上架时间
                </div>
                <div field="offline_time" headerAlign="center" allowSort="false">下架时间
                </div>

                <div field="status" headerAlign="center" allowSort="false">状态
                    <input id="statusFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="type" headerAlign="center" allowSort="false">上架类型
                    <input id="typeFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <!--                <div field="list_id" headerAlign="center" allowSort="false">上架清单ID-->
                <!--                    <input id="listidFilter" property="filter" class="mini-textbox" style="width:100%;"-->
                <!--                           onvaluechanged="onFilterChanged"-->
                <!--                    />-->
                <!--                </div>-->
                <div field="list_name" headerAlign="center" allowSort="false">上架清单名
                    <input id="listnameFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="product_m" headerAlign="center" allowSort="false">产品经理
                    <input id="productmFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="SAP_ItemCode" headerAlign="center">SAP物料号
                    <input id="sapitemcodeFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="SAP_ItemName" headerAlign="center" width='300px'>SAP物料名称
                    <input id="itemnameFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="qty" headerAlign="center">数量
                    <input  class="mini-textbox" style="width:100%;"/>
                </div>

<!--                <div field="BANK_Model" headerAlign="center">规格-->
<!--                    <input  class="mini-textbox" property="editor" style="width:100%;"/>-->
<!--                </div>-->
<!---->
<!---->
<!--                <div field="BANK_ItemCode" headerAlign="center">平台商品代码-->
<!--                    <input  class="mini-textbox" property="editor" style="width:100%;"/>-->
<!--                </div>-->

                <div field="pcode"  width="100px">主品物料号
                    <input id="pcodeFilter" property="filter" class="mini-textbox" style="width:100%;"
                           onvaluechanged="onFilterChanged"
                    />
                </div>

                <div field="color"  width="50px">颜色
                    <input class="mini-textbox" style="width:100%;"/>
                </div>
                <!--<div field="BANK_Model" headerAlign="center">规格-->
                <!--<input class="mini-textbox" style="width:100%;"/>-->
                <!--</div>-->

                <div field="maoli"  width="50px">毛利
                    <input class="mini-textbox"/>
                </div>

                <div field="mall_price"  width="50px">商城价
                    <input class="mini-textbox"/>
                </div>
                <!--<div field="market_price"  width="50px">市场价-->
                <!--<input  class="mini-textbox"/>-->
                <!--</div>-->

                <div field="maolilv"  width="50px">毛利率
                    <input class="mini-textbox"/>
                </div>

                <div field="purchase_price"  width="50px">采购价
                    <input class="mini-textbox"/>
                </div>
                <div field="r_purchase_price"  width="50px">实际采购价
                    <input class="mini-textbox"/>
                </div>
                <div field="by_stages"  width="50px">分期数
                    <input class="mini-textbox"/>
                </div>
                <div field="by_stages_rate"  width="50px">分期费率(%)
                    <input class="mini-textbox"/>
                </div>

                <div field="freight"  width="50px">预估运费
                    <input  class="mini-textbox"/>
                </div>

                <div field="gift_price"  width="50px">赠品价格
                    <input  class="mini-textbox"/>
                </div>

                <div field="bank_commission"  width="50px">佣金
                    <input class="mini-textbox"/>
                </div>

                <div field="zengzhishui"  width="50px">增值税等17%
                    <input class="mini-spinner"/>
                </div>

                <div field="packing_charge"  width="50px">包装费
                    <input  class="mini-textbox"/>
                </div>

                <div field="rebate"  width="50px">返利金额
                    <input  class="mini-textbox"/>
                </div>

                <div field="tamll_price"  width="100px">天猫价
                    <input  class="mini-textbox"/>
                </div>
                <div field="tamll_S_AMT"  width="100px">天猫销量
                    <input class="mini-textbox"/>
                </div>
                <div field="tamll"  width="100px">天猫
                    <input  class="mini-textbox"/>
                </div>

                <div field="jd_price"  width="100px">京东价
                    <input  class="mini-textbox"/>
                </div>
                <div field="jd_S_AMT"  width="100px">京东销量
                    <input class="mini-textbox"/>
                </div>
                <div field="jd"  width="100px">京东
                    <input  class="mini-textbox"/>
                </div>

                <div field="guangfa_price"  width="100px">广发价
                    <input  class="mini-textbox"/>
                </div>
                <div field="guangfa_S_AMT"  width="100px">广发销量
                    <input class="mini-textbox"/>
                </div>
                <div field="guangfa"  width="100px">广发
                    <input  class="mini-textbox"/>
                </div>

                <div field="jianhang_price"  width="100px">建行价
                    <input  class="mini-textbox"/>
                </div>
                <div field="jianhang_S_AMT"  width="100px">建行销量
                    <input class="mini-textbox"/>
                </div>
                <div field="jianhang"  width="100px">建行
                    <input  class="mini-textbox"/>
                </div>

                <div field="zhaohang_price"  width="100px">招行价
                    <input  class="mini-textbox"/>
                </div>
                <div field="zhaohang_S_AMT"  width="100px">招行销量
                    <input class="mini-textbox"/>
                </div>
                <div field="zhaohang"  width="100px">招行
                    <input  class="mini-textbox"/>
                </div>

                <div field="jiaohang_price"  width="100px">交行价
                    <input  class="mini-textbox"/>
                </div>
                <div field="jiaohang_S_AMT"  width="100px">交行销量
                    <input class="mini-textbox"/>
                </div>
                <div field="jiaohang"  width="100px">交行
                    <input  class="mini-textbox"/>
                </div>

                <div field="minsheng_price"  width="100px">民生价
                    <input  class="mini-textbox"/>
                </div>
                <div field="minsheng_S_AMT"  width="100px">民生销量
                    <input class="mini-textbox"/>
                </div>
                <div field="minsheng"  width="100px">民生
                    <input  class="mini-textbox"/>
                </div>

                <div field="pingan_price"  width="100px">平安价
                    <input  class="mini-textbox"/>
                </div>
                <div field="pingan_S_AMT"  width="100px">平安销量
                    <input class="mini-textbox"/>
                </div>
                <div field="pingan"  width="100px">平安
                    <input  class="mini-textbox"/>
                </div>

                <div field="zhongxin_price"  width="100px">中信价
                    <input  class="mini-textbox"/>
                </div>
                <div field="zhongxin_S_AMT"  width="100px">中信销量
                    <input class="mini-textbox"/>
                </div>
                <div field="zhongxin"  width="100px">中信
                    <input  class="mini-textbox"/>
                </div>

                <div field="remark"  width="100px">备注
                    <input class="mini-textbox"/>
                </div>

                <!--                <div field="BANK_FroTime" headerAlign="center">上架时间-->
                <!--                    <input  class="mini-datepicker" valueType='string' style="width:100%;"-->
                <!--                           format="yyyy-MM-dd H:mm:ss" timeFormat="H:mm:ss" showTime="true"/>-->
                <!--                </div>-->
                <!---->
                <!--                <div field="BANK_ToTime" headerAlign="center">下架时间-->
                <!--                    <input  class="mini-datepicker" valueType='string' style="width:100%;"-->
                <!--                           format="yyyy-MM-dd H:mm:ss" timeFormat="H:mm:ss" showTime="true"/>-->
                <!--                </div>-->

            </div>
        </div>


    </div>
    <!-- <div title="Tab2" iconCls="" >
        2
    </div> -->
</div>

<div id='editForm1'>

    <!--        <br/>选择Excel文件(格式.xls)：<input class="mini-htmlfile" name="uploadfile"  id="file1" style="width:300px;"/>-->
    <!--      -->
    <!--        <a class="mini-button" onclick="ajaxFileUpload()" enabled="" id='' >&nbsp;&nbsp;上传&nbsp;&nbsp;</a>-->

    <a class="mini-button" onclick="noticeDataB()" enabled="" id=''>&nbsp;&nbsp;读取数据&nbsp;&nbsp;</a>

    <a class="mini-button" onclick="savec()" enabled="" id='query-bt-c'
       style="display: none">&nbsp;&nbsp;驳回&nbsp;&nbsp;</a>

    <a class="mini-button" onclick="noticepdept()" id='query-bt-d' style="display: none">通知清单发起人</a>

    <a class="mini-button" onclick="savea()" enabled="" id='query-bt-a'
       style="display: none">&nbsp;&nbsp;提报&nbsp;&nbsp;</a>

    <a class="mini-button" onclick="saveb()" enabled="" id='query-bt-b'
       style="display: none">&nbsp;&nbsp;上架&nbsp;&nbsp;</a>

    <br/>
    <!--        <a href="/excel_mode.xls">下载Excel模版</a>-->
</div>
</body>
<script type="text/javascript">
    mini.parse();
    var grid = mini.get("datagrid1");
    grid.setPageSize(50);

    grid.on("drawcell", function (e) {
        var record = e.record,
            column = e.column,
            field = e.field,
            value = e.value;

        //格式化日期
        if (field == "BANK_FroTime" || field == 'BANK_ToTime' || field == 'ctime' || field == 'tb_time' || field == 'online_time' || field == 'offline_time' ) {
            if (mini.isDate(value)) e.cellHtml = mini.formatDate(value, "yyyy-MM-dd HH:mm:ss");
        }

        if (field == "oa_id") {
            e.cellHtml = '<a href="/SapSupplier/itemshow/id/'+value+'" target=_blank>'+value+'</a>&nbsp; ';
        }

        if (field == "logo") {
            if(value) {
                strs = value.split(",");
                e.cellHtml = '<img src="' + strs[0] + '"  style="width:50px" >';
            }
        }

        if (field == "type") {

            if(value == 0) {
                e.cellHtml = '普通';
            }else if (value == 1){
                e.cellHtml = '活动';
            } else if (value == 2){
                e.cellHtml = '集采';
            }
        }

        if (field == "status") {

            switch (value){
                case '0':
                    e.cellHtml = "默认";
                    break;
                case '1':
                    e.cellHtml = "通知发出";
                    break;
                case '2':
                    e.cellHtml = "提报";
                    break;
                case '3':
                    e.cellHtml = "上架";
                    break;
                case '4':
                    e.cellHtml = "下架";
                    break;
                default:
                    e.cellHtml = "通知发出";
                    break;
            }

        }

        if(record.pcode)
            e.cellStyle = "background:#94bad5";

        //action列，超连接操作按钮
        if (field == "BANK_ToTime") {
            /*   e.cellStyle = "text-align:center";
             e.cellHtml = '<a href="/sap/goods_gift_time.php?gid=' + record.LineId + '"/>赠品管理</a>&nbsp; '; */
            var date1 = new Date(record.BANK_FroTime);
            var date2 = new Date(record.BANK_ToTime);
            if (date1 > date2) {
                e.rowCls = "myrow";
                record.check = 0;
            } else {
                record.check = 1;
            }
        }

    });

    function fmt(num) {
        return parseFloat(num);
    }

    function cellendedit(e) {
        column = e.column,
            field = e.field,
            value = e.value;

        // 同时更新：毛利，毛利率，银行佣金，增值税等17%
        if(e.record.mall_price>0) {
            e.record.bank_commission = (fmt(e.record.mall_price) * fmt(e.record.by_stages_rate / 100));
            e.record.zengzhishui = (fmt(e.record.mall_price) - fmt(e.record.r_purchase_price)) * 0.07
            e.record.maoli = (fmt(e.record.mall_price) - fmt(e.record.r_purchase_price) + fmt(e.record.rebate) - fmt(e.record.freight) - fmt(e.record.gift_price) - fmt(e.record.bank_commission) - fmt(e.record.zengzhishui) - fmt(e.record.packing_charge));
            e.record.maolilv = e.record.maoli / fmt(e.record.mall_price) * 100;
        }else{
            e.record.bank_commission = 0;
            e.record.zengzhishui = 0;
            e.record.maoli = 0;
            e.record.maolilv = 0;
        }

        if (e.record._state != null) {
            update(mini.encode(e.record));
        }
    }

    function update(data) {

        $.ajax({
            url: "/Shelves/updateShelvesDetailedOnlyMallPrice",
            type: "post",
            data: {
                data: data
            },
            dataType: 'json',
            success: function (data) {
                //change();
            }
        });
    }

    function change(){

        noticeDataB();

    }

    //从上架通知获取物料
    function noticeDataB() {
        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }
        //var shelves_list_name = mini.get('shelves_list_name').getText();

        var itemInfo = mini.get('itemInfo').getValue();
//        if (shelves_list_name == '') {
//            mini.alert('必须输入上架清单名称');
//            return;
//        }

        grid.load({code: code, itemInfo:itemInfo})

        /*jQuery('#query-bt-a').show();
        jQuery('#query-bt-b').show();
        jQuery('#query-bt-c').show();
        jQuery('#query-bt-d').show();*/

    }
    function noticeData() {
        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }

        var shelves_list_name = mini.get('shelves_list_name').getText();
//        if (shelves_list_name == '') {
//            mini.alert('必须输入上架清单名称');
//            return;
//        }

        var grid = mini.get("datagrid1");

        var pageIndex = grid.getPageIndex();
        var pageSize = grid.getPageSize();

        $.ajax({
            url: "/shelves/getItem",
            type: "post",
            data: {'code': code, 'shelves_list_name':shelves_list_name,'pageIndex':pageIndex,'pageSize':pageSize},
            dataType: 'json',
            success: function (data) {
                if (data == null) {
                    mini.alert('无数据');
                    return;
                }
                /*jQuery('#query-bt-a').show();
                jQuery('#query-bt-b').show();
                jQuery('#query-bt-c').show();*/
                grid.setData(data.data);
                mini.unmask(document.body);

            },
            error: function (jqXHR, textStatus, errorThrown) {
                mini.unmask(document.body);
                alert(jqXHR.responseText);
            }
        });

    }


    function ajaxFileUpload() {
        mini.mask({
            el: document.body,
            cls: 'mini-mask-loading',
            html: '验证中...'
        });

        var inputFile = $("#file1 > input:file")[0];
        $.ajaxFileUpload({
            url: '/goods/importAjax',                 //用于文件上传的服务器端请求地址
            fileElementId: inputFile,               //文件上传域的ID
            //data: { Customer_Code: code },            //附加的额外参数
            dataType: 'json',                   //返回值类型 一般设置为json
            success: function (data, status)    //服务器成功响应处理函数
            {

                mini.unmask(document.body);
                jQuery('#query-bt').show();
                grid.setData(data.data);
//                if (data.msg != '') {
//                    mini.alert('以下SAP物料号不存在,系统已过滤<br/>' + data.msg)
//                }

            },
            error: function (data, status, e)   //服务器响应失败处理函数
            {
                mini.unmask(document.body);
                mini.alert(e);
            },
            complete: function () {
                var jq = $("#file1 > input:file");
                jq.before(inputFile);
                jq.remove();
            }
        });
    }

    function search() {

        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }
        grid.load({'code': code});
    }

    function savea() {
        //var data = grid.getData();
        var data = grid.getSelecteds();
        for (var i = 0; i < data.length; i++) {

            if (data[i].check == 0) {
                mini.alert('请修改错误数据后保存！');
                return;
            }

        }

        var form = new mini.Form("#fm1");
        var fmdata = form.getData();      //获取表单多个控件的数据

        if (fmdata.Customer_Code == '') {
            mini.alert('请选择客户');
            return;
        }

        var postData = {data: data, Customer_Code: fmdata.Customer_Code}
        var json = mini.encode(postData);

        mini.mask({
            el: document.body,
            cls: 'mini-mask-loading',
            html: '保存中...'
        });


        $.ajax({
            url: "/Shelves/preonline",
            data: {data: json},
            type: "post",
            dataType: 'json',
            success: function (data) {
                if (data.code > 0) {
                    mini.unmask(document.body);
                    if (data.msg != null) {
                        mini.alert(data.msg);
                    } else {
                        mini.alert('操作成功');

                    }
                    return;
                } else {
                    mini.unmask(document.body);
                    mini.alert(data.msg);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
            }
        });
    }

    function saveb() {
        //var data = grid.getData();
        var data = grid.getSelecteds();
        for (var i = 0; i < data.length; i++) {

            if (data[i].check == 0) {
                mini.alert('请修改错误数据后保存！');
                return;
            }

//            alert(data[i].BANK_ItemCode);
            if(data[i].BANK_ItemCode)
            {}else{
                mini.alert('必须填写平台商品代码');
                return;
            }
        }

        var form = new mini.Form("#fm1");
        var fmdata = form.getData();      //获取表单多个控件的数据

        if (fmdata.Customer_Code == '') {
            mini.alert('请选择客户');
            return;
        }

        var postData = {data: data, Customer_Code: fmdata.Customer_Code}
        var json = mini.encode(postData);

        mini.mask({
            el: document.body,
            cls: 'mini-mask-loading',
            html: '保存中...'
        });


        $.ajax({
            url: "/goods/importRelation",
            data: {data: json},
            type: "post",
            dataType: 'json',
            success: function (data) {
                if (data.code > 0) {
                    mini.unmask(document.body);
                    if (data.msg != null) {
                        mini.alert(data.msg);
                    } else {
                        mini.alert('操作成功');

                    }
                    return;
                } else {
                    mini.unmask(document.body);
                    mini.alert(data.msg);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
            }
        });
    }

    function savec() {
        //var data = grid.getData();
        var data = grid.getSelecteds();
        for (var i = 0; i < data.length; i++) {

            if (data[i].check == 0) {
                mini.alert('请修改错误数据后保存！');
                return;
            }

        }

        var form = new mini.Form("#fm1");
        var fmdata = form.getData();      //获取表单多个控件的数据

        if (fmdata.Customer_Code == '') {
            mini.alert('请选择客户');
            return;
        }

        var postData = {data: data, Customer_Code: fmdata.Customer_Code}
        var json = mini.encode(postData);

        mini.mask({
            el: document.body,
            cls: 'mini-mask-loading',
            html: '保存中...'
        });


        $.ajax({
            url: "/Shelves/rejectthem",
            data: {data: json},
            type: "post",
            dataType: 'json',
            success: function (data) {
                if (data.code > 0) {
                    mini.unmask(document.body);
                    if (data.msg != null) {
                        mini.alert(data.msg);
                    } else {
                        mini.alert('操作成功');

                    }
                    return;
                } else {
                    mini.unmask(document.body);
                    mini.alert(data.msg);
                }
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
            }
        });
    }

    function onValueChanged(e) {

        var item = e.selected;
        if (item) {
            mini.get('cname-show').setValue(item.text);
        }
    }

</script>

<script language="JavaScript">

    function onButtonEditB(e) {
        var btnEdit = this;

        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }

        mini.open({
            url:  "/Goods/poplistofshelves/customerCode/"+code,
            title: "选择清单",
            width: 650,
            height: 320,
            ondestroy: function (action) {

                if (action == "ok") {
                    var iframe = this.getIFrameEl();

                    var data = iframe.contentWindow.GetData();
                    data = mini.clone(data);
                    btnEdit.setValue(data.id);
                    btnEdit.setText(data.text);
                }
            }
        });

    }



    function noticepdept() {
        var name = mini.get('shelves_list_name').getText();
        if(name==''){
            mini.alert('请选择清单');
            return;
        }
        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }

        //self.location.href="/shelves/noticepdept/listname/"+name+"/code/"+code;

        $.ajax({
            url: "/shelves/noticepdept",
            data: {listname: name,code:code},
            type: "post",
            dataType: 'json',
            success: function (data) {
                mini.alert(data.msg)
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
            }
        });

    }

    function exportExcel() {
        var name = mini.get('shelves_list_name').getText();
        if(name==''){
            mini.alert('请选择清单');
            return;
        }
        var code = mini.get('Customer_Code').getValue();
        if (code == '') {
            mini.alert('必须输入客户代码');
            return;
        }

        self.location.href="/shelves/exportexcelshelveslistforsales/listname/"+name+"/code/"+code;
    }

</script>

<script type="text/javascript">
    function onFilterChanged(e) {

        var typebox = mini.get("typeFilter");
        //var listidbox = mini.get("listidFilter");
        var listnamebox = mini.get("listnameFilter");
        var productmbox = mini.get("productmFilter");
        var itemnamebox = mini.get("itemnameFilter");
        var pcodebox = mini.get("pcodeFilter");
        var sapitemcodebox = mini.get("sapitemcodeFilter");
        var statusbox = mini.get("statusFilter");

        var type = typebox.getValue().toLowerCase();
        //var listid = listidbox.getValue().toLowerCase();
        var listname = listnamebox.getValue().toLowerCase();
        var productm = productmbox.getValue().toLowerCase();
        var itemname = itemnamebox.getValue().toLowerCase();
        var pcode = pcodebox.getValue().toLowerCase();
        var sapitemcode = sapitemcodebox.getValue().toLowerCase();
        var statuscode = statusbox.getValue().toLowerCase();

        //多条件组合过滤
        grid.filter(function (row) {

            //type
            var r1 = true;
            if (type) {
                r1 = String(row.type).toLowerCase().indexOf(type) != -1;
            }

            //listid
//            var r2 = true;
//            if (listid) {
//                r2 = String(row.list_id).toLowerCase().indexOf(listid) != -1;
//            }

            //product_m
            var r3 = true;
            if (productm) {
                r3 = String(row.product_m).toLowerCase().indexOf(productm) != -1;
            }

            //list_name
            var r4 = true;
            if (listname) {
                r4 = String(row.list_name).toLowerCase().indexOf(listname) != -1;
            }

            //itemname
            var r5 = true;
            if (itemname) {
                r5 = String(row.SAP_ItemName).toLowerCase().indexOf(itemname) != -1;
            }

            //pcode
            var r6 = true;
            if (pcode) {
                r6 = String(row.pcode).toLowerCase().indexOf(pcode) != -1;
            }

            //sapitemcode
            var r7 = true;
            if (sapitemcode) {
                r7 = String(row.SAP_ItemCode).toLowerCase().indexOf(sapitemcode) != -1;
            }

            //status
            var r8 = true;
            if (statuscode) {
                r8 = String(row.status).toLowerCase().indexOf(statuscode) != -1;
            }

            return r1 && r3 && r4 && r5 && r6 && r7 && r8;
        });
    }

</script>

</html>